#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：    pydantic_yaml_check.py
   Remark :  使用pydantic验证yaml文件是否符合规范
-------------------------------------------------
"""
from pprint import pprint

import pytest

from apitesting.common.file.yaml_handler import ReadYaml
from apitesting.src.models.test_suite.test_suite_model import TestSuite

# template_case = ReadYaml("test_suite/demo_api_templete.yaml").get_data()
test_case = ReadYaml("/data/demo_service/生成验证码.yaml").get_data()


# 测试用例参数化解析
@pytest.mark.parametrize("testcase", [test_case])
def test_demo_api(testcase: TestSuite | dict):
    print()
    testcase = TestSuite(**testcase)

    pprint(testcase.model_dump())

    # 发起接口测试请求
    # response: dict = ApiTestRequest(testcase).send_request()

    # 断言校验
    # ResponseAssert(testcase, response).assert_data()
